package com.qinglei.recoup.system.enums;

/**
 * 事件枚举类
 */
public enum EventEnum {
    ALARM_OUT_BED(1, EventEnum.TYPE_ALARM, "出现离床过久异常", true),

    @Deprecated
    SLEEP_STATUS_OUT_BED(2, EventEnum.TYPE_SLEEP_STATUS, "用户状态变化为离床"),
    @Deprecated
    SLEEP_STATUS_CLEAR(3, EventEnum.TYPE_SLEEP_STATUS, "老人进入清醒状态"),
    @Deprecated
    SLEEP_STATUS_LIGHT(4, EventEnum.TYPE_SLEEP_STATUS, "老人进入浅睡状态"),
    @Deprecated
    SLEEP_STATUS_DEEP(5, EventEnum.TYPE_SLEEP_STATUS, "老人进入深睡状态"),

    MONITOR_SWITCH_ON(6, EventEnum.TYPE_MONITOR_TIME, "%s 开启监测功能，睡眠监测功能开始"),
    MONITOR_SWITCH_OFF(7, EventEnum.TYPE_MONITOR_TIME, "%s 关闭监测功能，睡眠监测功能暂停"),
    MONITOR_TIME_START(8, EventEnum.TYPE_MONITOR_TIME, "监测时段开始"),
    MONITOR_TIME_END(9, EventEnum.TYPE_MONITOR_TIME, "监测时段结束"),
    MONITOR_TIME_ADD(10, EventEnum.TYPE_MONITOR_TIME, "添加监测时段"),
    MONITOR_TIME_DELETE(11, EventEnum.TYPE_MONITOR_TIME, "删除监测时段"),
    NURSE_WORK_LOGIN(12, EventEnum.TYPE_NURSE_WORK, "%s登录"),
    NURSE_WORK_LOGOUT(13, EventEnum.TYPE_NURSE_WORK, "%s退出登录"),
    TOUR_START(14, EventEnum.TYPE_TOUR, "在线巡查已开始，结束时间是：%s"),
    TOUR_END(15, EventEnum.TYPE_TOUR, "%s 完成在线巡查"),
    TOUR_UNFINISHED(16, EventEnum.TYPE_TOUR, "%s 在巡查结束时间(%s)前未完成在线巡查"),
    EVENT_PROC_TAKE(17, EventEnum.TYPE_EVENT_PROC, "%s 已看到%s异常并去处理", true),
    EVENT_PROC_PROCESSING(18, EventEnum.TYPE_EVENT_PROC, "处理中"),
    EVENT_PROC_FINISH(19, EventEnum.TYPE_EVENT_PROC, "%s 完成%s异常处理并上报处理结果：\n%s"), //  "异常原因：\n文字备注："
    EVENT_PROC_UNFINISHED(20, EventEnum.TYPE_NURSE_WORK_ERROR, "%s 未能在%s内前去处理%s异常", true),
    MONITOR_OFFLINE(21, EventEnum.TYPE_MONITOR_TIME, "监测仪离线"),
    MONITOR_ONLINE(22, EventEnum.TYPE_MONITOR_TIME, "监测仪恢复正常"),
    EVENT_PROC_PROC_MISSED_EVENT(23, EventEnum.TYPE_EVENT_PROC, "%s 已对%d条漏掉的异常做了处理，文字备注：%s", true),
    EVENT_PROC_HAPPEN_MISSED_EVENT(24, EventEnum.TYPE_NURSE_WORK_ERROR, "%s 漏掉了%s异常", true),

    ALARM_FALL_DOWN(25, EventEnum.TYPE_ALARM, "有人跌倒", true),

    ALARM_BREATH_BPM_HIGH(26, EventEnum.TYPE_ALARM, "呼吸过速", true),
    ALARM_BREATH_BPM_NORMAL(27, EventEnum.TYPE_MONITOR_TIME, "呼吸恢复正常"),
    ALARM_BREATH_BPM_LOW(28, EventEnum.TYPE_ALARM, "呼吸暂停过久", true),
    ALARM_HEART_BPM_HIGH(29, EventEnum.TYPE_ALARM, "心跳过速", true),
    ALARM_HEART_BPM_NORMAL(30, EventEnum.TYPE_MONITOR_TIME, "心跳恢复正常"),
    ALARM_HEART_BPM_LOW(31, EventEnum.TYPE_ALARM, "心跳过缓", true),
    LARGE_USER_ACTION(32, EventEnum.TYPE_MONITOR_TIME, "用户动作有点大");

    /**
     * 异常报警
     */
    public static final int TYPE_ALARM = 1;

    /**
     * 睡眠状态变化
     */
    public static final int TYPE_SLEEP_STATUS = 2;

    /**
     * 监测仪工作情况
     */
    public static final int TYPE_MONITOR_TIME = 4;
    /**
     * 交接班记录
     */
    public static final int TYPE_NURSE_WORK = 5;
    /**
     * 在线巡查
     */
    public static final int TYPE_TOUR = 6;
    /**
     * 异常处理
     */
    public static final int TYPE_EVENT_PROC = 7;


    /**
     * 护工不合规处理
     */
    public static final int TYPE_NURSE_WORK_ERROR = 8;



    //############### 异常事件 类型 ###############
    /**
     * 离床事件
     */
    public static final int LEAVE_BED = 1;
    /**
     * 跌倒
     */
    public static final int FALL = 2;
    /**
     * 呼吸过速
     */
    public static final int BREATHING_FAST = 4;
    /**
     * 呼吸暂停过久
     */
    public static final int BREATHING_STOP = 5;
    /**
     * 心跳过速
     */
    public static final int HEARTBEAT_FAST = 7;
    /**
     * 心跳过缓
     */
    public static final int HEARTBEAT_SLOW = 8;


    private int code;
    private int type;
    private String content;
    /**
     * 是否突出显示
     */
    private boolean stress = false;

    EventEnum(int code, int type, String content) {
        this.code = code;
        this.type = type;
        this.content = content;
        this.stress = false;
    }

    EventEnum(int code, int type, String content, boolean stress) {
        this.code = code;
        this.type = type;
        this.content = content;
        this.stress = stress;
    }


    /**
     * 根据code获取内容
     *
     * @param code
     * @return
     */
    public static String getContent(int code) {
        for (EventEnum c : EventEnum.values()) {
            if (c.getCode() == code) {
                return c.content;
            }
        }
        return null;
    }

    /**
     * 根据code获取枚举值
     *
     * @param code
     * @return
     */
    public static EventEnum getByCode(int code) {
        for (EventEnum c : EventEnum.values()) {
            if (c.getCode() == code) {
                return c;
            }
        }
        return null;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean isStress() {
        return stress;
    }

    public void setStress(boolean stress) {
        this.stress = stress;
    }
}
